/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 */
package com.jeesite.modules.interceptor;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * minio下载拦截器
 *
 * @author ya_jun
 */
@Configuration(proxyBeanMethods = false)
@EnableWebMvc
public class MinioDownloadInterceptorConfig implements WebMvcConfigurer {

    @Value("${adminPath}")
    private String adminPath;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = registry.addInterceptor(new MinioDownloadInterceptor());
        registration.addPathPatterns(adminPath + "/file/download/**");
    }

}